package com.qgy.springsecurity.configs;

import com.qgy.springsecurity.models.MyResult;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Configuration
public class ExceptionConfig {

    @ExceptionHandler(Exception.class)
    public MyResult handleException(Exception e) {
        return MyResult.error().message(e.getMessage());
    }
}
